<template>
  <div>
    <el-dialog
      title="详情页面"
      :visible.sync="dialogVisible"
      center
      width="40%"
      :before-close="handleClose">

      <el-card loading>
        <el-form :model="group"  label-width="100px">
          <el-row>
            <el-col :span="12">
          <el-form-item label="分类名称:">
            <span>{{groupOne.fname}}</span>
          </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
          <el-form-item label="分类编码:">
            <span>{{groupOne.fnumber}}</span>
          </el-form-item>
            </el-col>
          </el-row>
          <el-form-item label="上级分类:">
            <el-select v-model="groupOne.fparentid" disabled>
              <el-option v-for="item in groupList" :key="item.nodeId+''" :label="item.nodeName" :value="item.nodeId+''"></el-option>
            </el-select>
          </el-form-item>
        </el-form>
      </el-card>
      <span slot="footer" class="dialog-footer" center>
    <el-button  @click="handleClose" center>关 闭</el-button>
  </span>
    </el-dialog>
  </div>
</template>

<script>
import Group from "@/api/psyManage/Group";

export default {
  name: "detail_group",
  props:{
   group:Object,
    fid:'',
    parentid:'',
  },
  data(){
    return{
      dialogVisible:true,
      loading: true,
      groupList:[],
      groupOne:{},
    }

  },
  async created() {
    this.loading = true
    let api = new Group()
    let groupList = await api.queryGroupTree({})
    this.groupList=groupList.data
    this.init();
    this.loading=false
  },
  methods: {
    handleClose() {
      this.$emit("close", {name: 'detail', isRefresh: false});
    },
    init(){
      this.loading=true;
      const api=new Group();
      console.log(this.group)
      api.selectOne({pid:this.group.fid}).then(res => {
        this.groupOne=res.data
        this.loading=false;
      }).catch( res=>(this.loading=false))
    }
  }
}
</script>

<style scoped >

</style>

